package org.germinus.telcoblocks.servicios.diagram.part;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.gef.Tool;
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteDrawer;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool;
import org.germinus.telcoblocks.servicios.diagram.providers.TelcoblocksElementTypes;

/**
 * @generated
 */
public class TelcoblocksPaletteFactory {

	/**
	 * @generated
	 */
	public void fillPalette(PaletteRoot paletteRoot) {
		paletteRoot.add(createEventos1Group());
		paletteRoot.add(createServicios2Group());
		paletteRoot.add(createBasesdeconocimiento3Group());
		paletteRoot.add(createHerramientas4Group());
	}

	/**
	 * Creates "Eventos" palette tool group
	 * @generated
	 */
	private PaletteContainer createEventos1Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				Messages.Eventos1Group_title);
		paletteContainer.add(createIM1CreationTool());
		paletteContainer.add(createTelefono2CreationTool());
		paletteContainer.add(createWeb3CreationTool());
		return paletteContainer;
	}

	/**
	 * Creates "Servicios" palette tool group
	 * @generated
	 */
	private PaletteContainer createServicios2Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				Messages.Servicios2Group_title);
		paletteContainer.add(createServicioGen1CreationTool());
		paletteContainer.add(createLlamadas2CreationTool());
		paletteContainer.add(createClickToDial3CreationTool());
		paletteContainer.add(createPersonalizacion4CreationTool());
		return paletteContainer;
	}

	/**
	 * Creates "Bases de conocimiento" palette tool group
	 * @generated
	 */
	private PaletteContainer createBasesdeconocimiento3Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				Messages.Basesdeconocimiento3Group_title);
		paletteContainer.add(createFacturacion1CreationTool());
		paletteContainer.add(createAnuncios2CreationTool());
		paletteContainer.add(createDesvio3CreationTool());
		return paletteContainer;
	}

	/**
	 * Creates "Herramientas" palette tool group
	 * @generated
	 */
	private PaletteContainer createHerramientas4Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				Messages.Herramientas4Group_title);
		paletteContainer.add(createEnlace1CreationTool());
		return paletteContainer;
	}

	/**
	 * @generated
	 */
	private ToolEntry createIM1CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.IM_2005);
		NodeToolEntry entry = new NodeToolEntry(Messages.IM1CreationTool_title,
				Messages.IM1CreationTool_desc, types);
		entry.setSmallIcon(TelcoblocksServiciosDiagramEditorPlugin
				.findImageDescriptor("/telcoblocks/imagenes/toolbox/IM.png")); //$NON-NLS-1$
		entry.setLargeIcon(TelcoblocksServiciosDiagramEditorPlugin
				.findImageDescriptor("/telcoblocks/imagenes/toolbox/IM.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createTelefono2CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Telefono_2010);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Telefono2CreationTool_title,
				Messages.Telefono2CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksServiciosDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/telefono.png")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksServiciosDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/telefono.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createWeb3CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Web_2007);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Web3CreationTool_title,
				Messages.Web3CreationTool_desc, types);
		entry.setSmallIcon(TelcoblocksServiciosDiagramEditorPlugin
				.findImageDescriptor("/telcoblocks/imagenes/toolbox/web.png")); //$NON-NLS-1$
		entry.setLargeIcon(TelcoblocksServiciosDiagramEditorPlugin
				.findImageDescriptor("/telcoblocks/imagenes/toolbox/web.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createServicioGen1CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.ServicioGen_2003);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.ServicioGen1CreationTool_title,
				Messages.ServicioGen1CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksServiciosDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/block.png")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksServiciosDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/block.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createLlamadas2CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Llamadas_2002);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Llamadas2CreationTool_title,
				Messages.Llamadas2CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksServiciosDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/block.png")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksServiciosDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/block.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createClickToDial3CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.ClickToDial_2001);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.ClickToDial3CreationTool_title,
				Messages.ClickToDial3CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksServiciosDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/block.png")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksServiciosDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/block.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createPersonalizacion4CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Personalizacion_2004);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Personalizacion4CreationTool_title,
				Messages.Personalizacion4CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksServiciosDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/block.png")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksServiciosDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/block.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createFacturacion1CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Facturacion_2006);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Facturacion1CreationTool_title,
				Messages.Facturacion1CreationTool_desc, types);
		entry.setSmallIcon(TelcoblocksServiciosDiagramEditorPlugin
				.findImageDescriptor("/telcoblocks/imagenes/toolbox/base.png")); //$NON-NLS-1$
		entry.setLargeIcon(TelcoblocksServiciosDiagramEditorPlugin
				.findImageDescriptor("/telcoblocks/imagenes/toolbox/base.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createAnuncios2CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Anuncios_2009);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Anuncios2CreationTool_title,
				Messages.Anuncios2CreationTool_desc, types);
		entry.setSmallIcon(TelcoblocksServiciosDiagramEditorPlugin
				.findImageDescriptor("/telcoblocks/imagenes/toolbox/base.png")); //$NON-NLS-1$
		entry.setLargeIcon(TelcoblocksServiciosDiagramEditorPlugin
				.findImageDescriptor("/telcoblocks/imagenes/toolbox/base.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createDesvio3CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Desvio_2008);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Desvio3CreationTool_title,
				Messages.Desvio3CreationTool_desc, types);
		entry.setSmallIcon(TelcoblocksServiciosDiagramEditorPlugin
				.findImageDescriptor("/telcoblocks/imagenes/toolbox/base.png")); //$NON-NLS-1$
		entry.setLargeIcon(TelcoblocksServiciosDiagramEditorPlugin
				.findImageDescriptor("/telcoblocks/imagenes/toolbox/base.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createEnlace1CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Enlace_4001);
		LinkToolEntry entry = new LinkToolEntry(
				Messages.Enlace1CreationTool_title,
				Messages.Enlace1CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksServiciosDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Enlace.gif")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksServiciosDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Enlace.gif")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private static class NodeToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List elementTypes;

		/**
		 * @generated
		 */
		private NodeToolEntry(String title, String description,
				List elementTypes) {
			super(title, description, null, null);
			this.elementTypes = elementTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}

	/**
	 * @generated
	 */
	private static class LinkToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List relationshipTypes;

		/**
		 * @generated
		 */
		private LinkToolEntry(String title, String description,
				List relationshipTypes) {
			super(title, description, null, null);
			this.relationshipTypes = relationshipTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}
}
